<div id='breadcrumb'>
  <%=  breadcrumb_for_product(@product)%>
</div>
<h4><%=h @product.name %></h4>
<div id='medium_img'>
  <% if @product.image_url%>
    <%= image_tag url_for_file_column(@product, "image_url"),:class=>'product_img' %>
  <% end  %>
</div>
<div id='product_main_info'>
  <table>
    <tr class="product_property">
      <td>
        <label>类别:</label>
      </td>
      <td>
        <%=h @product.category.title if @product.category %>
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>品牌:</label>
      </td>
      <td  class="product_brand">
        <%=h @product.brand.name if @product.brand %>
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>名称:</label>
      </td>
      <td>
        <%=h @product.name %>
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>大小:</label>
      </td>
      <td>
        <%=h @product.size %> <%=h @product.unit %>
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>货号:</label>
      </td>
      <td>
        <%=h @product.sn %>
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>市场价:</label>
      </td>
      <td class="official_price">
        <%=@product.official_price %>&yen;
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>现价:</label>
      </td>
      <td>
        <span class="yen"><%=@product.retail_price %></span>
      </td>
    </tr>

    <tr class="product_property">
      <td>
        <label>剩余天数:</label>
      </td>
      <td>
        <span style="color:blue;"><%=@product.last %></span>
      </td>
    </tr>




    <% if @product.properties.count > 0 %>
      <% for p in @product.properties %>
        <tr>
          <td>
            <label>
              <%=p.name%>:
            </label>
          </td>
          <td>
            <%=h p.value %>
          </td>
        </tr>
      <% end %>
    <%end%>

    <tr id="link_button_container">
      <td>
        购买<input class="item_quantity"  id="item_quantity_on_detail" type="text"  size="1" value="1" />件
      </td>
      <td>
        <a href="javascript:void(0);" onclick="addToCart(<%=@product.id%>);" >
          <img src="/images/add_to_cart.gif" alt="加入购物车" style="margin-top:5px;"  />
        </a>
      </td>
    </tr>
  </table>

</div>

<div id='product_description_container'>

  <h4>产品说明</h4>

  <%  if @product.description  %>
    <%= @product.description %>
  <%  end %>
</div>
<% if @product.comments.size > 0 %>
  <div>
    <h4>经验分享</h4>
    <ul id="comment">
      <% for comment in @product.comments %>
        <li>
          <span class="nick_name"><%=User.find(comment.user_id).nickname%>说：</span><%=comment.content%><br />
          <span class="date"><%=comment.created_at.strftime("%Y-%m-%d") %></span>
        </li>
      <% end %>
    </ul>
  </div>
<%end%>

<p class="action_link">
  <% if admin? %>
    <%= link_to '编辑',[:edit,@product],:class=>'action_edit' -%>
    |
  <%end%>
  <%= link_to '后退', category_path(@product.category),:class=>'action_back' -%> |
  <a href="/products/favorite/<%=@product.id%>" class="action_favorite" >
    收藏
  </a>
</p>







